package com.zcy.nidavellir.multilogin.login

import android.app.Activity
import com.zcy.nidavellir.multilogin.proxy.ILogin
import com.zcy.nidavellir.multilogin.proxy.LOGINTYPE
import java.lang.ref.WeakReference

/**
 * @author:       zhaocy
 * @description:  ${DESP}
 * @date:         2018/9/28
 */
object LoginFactory {

    lateinit var currentLoginImpl: ILogin

    fun createLoginImpl(weakReference: WeakReference<Activity>, type: LOGINTYPE): ILogin {
        currentLoginImpl = when (type) {
            LOGINTYPE.WECHAT -> {
                WeChatLoginImpl(weakReference)
            }
            LOGINTYPE.FACEBOOK -> {
                FacebookLoginImpl(weakReference)
            }
            LOGINTYPE.TWITTER -> {
                TwitterLoginImpl(weakReference)
            }
            LOGINTYPE.PHONE -> {
                PhoneLoginImpl(weakReference)
            }
            LOGINTYPE.GOOGLE -> {
                GoogleLoginImpl(weakReference)
            }
        }

        return currentLoginImpl

    }

}